//
//  AsyncTaskItem.h
//  AsyncTaskTrigger
//
//  Created by zhouzuosong on 2020/9/17.
//

#import <Foundation/Foundation.h>
#import "AsyncTask.h"

NS_ASSUME_NONNULL_BEGIN

@interface AsyncTaskItem : NSObject

@property (nonatomic, copy) NSString *taskGroupKey;

@property (nonatomic, assign) LXTaskAsyncType asyncType;

- (instancetype)initWithAsyncType:(LXTaskAsyncType)asyncType;

#pragma mark - *****  手动Handler  *****

- (void)addActionBlock:(LXTaskActionBlock)actionBlock completBlock:(LXTaskActionBlock)completBlock;

- (void)addActionBlock:(LXTaskActionBlock)actionBlock;

#pragma mark - *****  Block Handler  *****

- (void)addHandlerActionBlock:(LXSemaphoreBlock)actionBlock completBlock:(LXTaskActionBlock)completBlock;

- (void)addHandlerActionBlock:(LXSemaphoreBlock)actionBlock;

#pragma mark - *****  执行任务  *****

/// 开启任务
/// @param completBlock 任务组完成后的最终回调
- (void)startTaskActionWithCompletBlock:(LXTaskActionBlock)completBlock;

/// 异步任务完成 发送信号量
- (void)sendSemaphore;

/// 是否正在工作中
- (BOOL)isWorking;

/// 暂停任务
- (void)suspendWork;

/// 继续任务
- (void)continueWork;

/// 取消工作
- (void)cancelOperation;

@end

NS_ASSUME_NONNULL_END
